#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define rep(i, x, y) for(int i = (x); i <= (y); i++) 
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int , int >;
using vec = vector < int >;
using veg = vector < pii >;

int read() {
	int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-', ch = getchar(); 
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar(); return f ? -x : x;
}

const int N = 4e5 + 10;
const int V = 3e5 + 1;

ll n, K, s[N << 1], ts[N << 1], ans;
int cnt[N << 1], a[N << 1];

bool check(ll x) {
	return ((__int128)x * n - ts[V]) <= K;
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in", "r", stdin);
#endif
	cin >> n >> K;
	rep(i, 1, n) cin >> a[i], cnt[a[i]]++;
	rep(i, 1, V << 1) s[i] = s[i - 1] + cnt[i], ts[i] = ts[i - 1] + 1ll * cnt[i] * i;
	rep(i, 1, V) {
		ll t = 0;
		rep(j, i, V + V) {
			t += (s[j] - s[j - i]) * j - (ts[j] - ts[j - i]);
			j += i - 1;
		}
		if(t <= K) ans = max(ans, 1ll * i);
	}
	ll l = V, r = K;
	while(l <= r) {
		ll mid = l + r >> 1;
		if(check(mid)) ans = max(ans, mid), l = mid + 1;
		else r = mid - 1;
	}
	//cerr << check(l) << " " << check(r) << endl;
	cout << ans << endl;
	return 0;
}
